<?php 
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
	
include ABS_PATH . "header.php"; ?>

<!-- load our grid thingy -->
<script type="text/javascript">
jQuery(document).ready(function(){
  var lastSel;
  jQuery("#agentsList").jqGrid({
    url:'<?=ROOT_URL; ?>/ui/fetchAgentsPage.php',
    editurl:'<?=ROOT_URL; ?>/ui/saveAgentsPage.php',
    datatype: 'xml',
    mtype: 'POST',
    colNames:['UUID', 'Name', 'OwnerKey', 'OwnerName', 'Location', 'Position', 'Rotation', 'Velocity', 'Energy', 'Money', 'Happiness', 'Class', 'SubType', 'PermURL', 'LastUpdate', 'BestPath', 'SecondBestPath', 'CurrentTarget'],
    colModel :[ 
      {name:'UUID', index:'UUID', width:80, editable:true, sortable:true}, 
      {name:'Name', index:'Name', width:80, editable:true, sortable:true},
      {name:'OwnerKey', index:'UUID', width:80, editable:true, sortable:true}, 
      {name:'OwnerName', index:'Name', width:80, editable:true, sortable:true},
      {name:'Location', index:'Location', width:60, editable:true, sortable:true},
      {name:'Position', index:'Position', width:60, editable:true, sortable:true},
      {name:'Rotation', index:'Rotation', width:60, editable:true},
      {name:'Velocity', index:'Velocity', width:60, editable:true},
      {name:'Energy', index:'Energy', width:35, editable:true, sortable:true}, 
      {name:'Money', index:'Money', width:35, editable:true, sortable:true},
      {name:'Happiness', index:'Happiness', width:35, editable:true, sortable:true},
      {name:'Class', index:'Class', width:35, editable:true, sortable:true},
      {name:'SubType', index:'SubType', width:35, editable:true},
      {name:'PermURL', index:'PermURL', width:80, editable:true},
      {name:'LastUpdate', index:'LastUpdate', width:160, editable:true, sortable:true},
      {name:'BestPath', index:'BestPath', width:30, editable:true, sortable:true},
      {name:'SecondBestPath', index:'SecondBestPath', width:30, editable:true, sortable:true},
      {name:'CurrentTarget', index:'CurrentTarget', width:60, editable:true, sortable:true},
    ],
    onSelectRow: function(id){
  		if(id && id!==lastSel){ 
    		jQuery('#agentsList').restoreRow(lastSel); 
	  		jQuery('#agentsList').editRow(id, true); 
    		lastSel=id; 
  		}
	},
    pager: jQuery('#pager'),
    rowNum:15,
    rowList:[15,30,45],
    height: 355,
    sortname: 'LastUpdate',
    sortorder: "desc",
    multiselect: true,
    viewrecords: true,
    imgpath: '<?=ROOT_URL; ?>/images',
    caption: 'Agents'
  }).navGrid('#pager',
  {view:true}, //options
{savekey: [true,13], navkeys: [true,38,40], reloadAfterSubmit:false, jqModal:false, closeOnEscape:true, bottominfo:"Fields marked with (*) are required"}, // edit options
{savekey: [true,13], navkeys: [true,38,40], reloadAfterSubmit:false, jqModal:false, closeOnEscape:true,bottominfo:"Fields marked with (*) are required"}, // add options
{reloadAfterSubmit:false,jqModal:false, closeOnEscape:true}, // del options
{closeOnEscape:true}, // search options
{navkeys: [true,38,40], height:250,jqModal:false,closeOnEscape:true} // view options
);
});
</script>
<?php 
	include ABS_PATH . "navigation.php";
	include ABS_PATH . "menu.php";
	
// navigation starts here
	global $cur_option;
	$cur_option = "Agents";
	menu($cur_option);
?>

<?php include ABS_PATH . "after-navigation.php"; ?>
            <!-- add your content here -->
            <table id="agentsList" class="scroll" width="100%"></table> 
			<div id="pager" class="scroll" style="text-align:center;"></div> 
			<a href="javascript:void(0)" id="m1">Do something</a>
<?php include ABS_PATH . "footer.php"; ?>